package com.itheima.set;

import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;

public class Demo02 {

    public static void main(String[] args) {
        Set<String> set = new TreeSet<>();
        set.add("def");
        set.add("jmn");
        set.add("abcBB");
        set.add("ghi");
        set.add("abc");

        set.forEach(s-> System.out.println(s));

        for (String s : set) {
            System.out.println(s);
        }
        Iterator<String> iterator = set.iterator();
        while (iterator.hasNext()){
            String s = iterator.next();
            System.out.println(s);
        }
    }
}
